code = input('请选择功能[1:注册|2.登录]:')
if code =='1':
    username =input('用户名:')
    password = input('密码:')
    f = open('test/user_info.txt',mode='a',encoding='utf8')
    f.write(f'{username}|{password}\n')
    f.close()
elif code == '2':
    username = input('请输入用户名')
    password = input('请输入密码:')
    f = open('test/user_info.txt',mode='r',encoding='utf8')
    user_list = f.readlines()
    for i in user_list:
        user = i.rstrip().split('|')
        if username == user[0] and password == user[1]:
            print('登录成功')
            break
    else:

        print('登录失败')